﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

using RBS.Core.Model;

namespace RBS.Web.Hotel.Models.Dine
{
    public class CookDishViewModel
    {
        #region Ctors

        public CookDishViewModel() { 
            
        }

        public CookDishViewModel(D_CuiCai entity) {
            this.Id = entity.Id;
            this.DishId = entity.DishId;
            this.DishName = entity.DishName;
            this.DishState = entity.DishState;
            this.OrderId = entity.OrderId;
            //this.DineTable = entity.DineTable;
            this.CookChef = entity.CookChef;
            this.OrderConfirmTime = entity.OrderConfirmTime;
            this.CookWeight = entity.CookWeight;
            this.PressWeight = entity.PressWeight;
            this.OtherWeight = entity.OtherWeight;
        }

        #endregion

        /// <summary>
        /// Id
        /// </summary>		 
        public int Id { get; set; }
        /// <summary>
        /// 菜id
        /// </summary>		 
        public int DishId { get; set; }
        /// <summary>
        /// 菜名
        /// </summary>		 
        public string DishName { get; set; }
        /// <summary>
        /// 状态
        /// </summary>		 
        public int DishState { get; set; }
        /// <summary>
        /// 订单ID
        /// </summary>		 
        public int OrderId { get; set; }
        /// <summary>
        /// 餐桌
        /// </summary>		 
        public String DineTable { get; set; }
        /// <summary>
        /// 厨师
        /// </summary>		 
        public string CookChef { get; set; }
        /// <summary>
        /// OrderConfirmTime
        /// </summary>		 
        public DateTime OrderConfirmTime { get; set; }
        /// <summary>
        /// 烹饪权重
        /// </summary>		 
        public int CookWeight { get; set; }
        /// <summary>
        /// 时间权重
        /// </summary>		 
        public int TimeWeight {

            get 
            {
                var weight = ConfigurationManager.AppSettings["OneTimeWeight"] == null ? 5 : Convert.ToInt32(ConfigurationManager.AppSettings["OneTimeWeight"]);
                var timeSpan = DateTime.Now - OrderConfirmTime;
                return (timeSpan.Hours * 60 + timeSpan.Minutes) * weight;
            }

        }
        /// <summary>
        /// 催菜权重
        /// </summary>		 
        public int PressWeight { get; set; }
        /// <summary>
        /// 其他权重
        /// </summary>
        public int OtherWeight { get; set; }

        /// <summary>
        /// 总权重
        /// </summary>
        public Int32 TotalWeight {
            get {
                return this.CookWeight + this.TimeWeight + this.PressWeight + this.OtherWeight;
            }
        }
    }

    public enum CookDishState { 
        
    }
}